from pathlib import Path
import json
numbers = [2,1,4,5,6,76,2,1,23]
path = Path('numbers.json')
contents = json.dumps(numbers)
path.write_text(contents)